package com.xuxin.baby.presenter;

import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.contract.ChildTargetContract;
import com.xuxin.baby.model.ChildTargetModel;

/**
 * Created by xu_xin
 * Created on 2020/10/22 0022
 * 0-12个月的目标能力
 */
public class ChildTargetPresenter implements ChildTargetContract.Presenter {
    private  final ChildTargetModel model;
    private  final ChildTargetContract.View view;

    public ChildTargetPresenter(ChildTargetContract.View view) {
        this.view = view;
        model = new ChildTargetModel();
    }

    @Override
    public void getChildTarget() {
        if (null != model) {
            model.getChildTarget(this);
        }
    }

    @Override
    public void onSuccess(BaseBean baseBean) {
        if (null != view) {
            view.onSuccess(baseBean);
        }
    }

    /**
     * 以下内容复用(用于请求完成后的操作)
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}